package until;

import com.alibaba.druid.pool.DruidDataSource;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.Connection;
import java.sql.SQLException;

public class DBUtils {
	private static DruidDataSource dataSource;
	private static QueryRunner queryRunner;
	static {
		dataSource = new DruidDataSource();
		dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql://localhost:3306/test929");
		dataSource.setUsername("root");
		dataSource.setPassword("maihao1122");
		queryRunner= new QueryRunner(dataSource);
	}
	public static DruidDataSource getDataSource () {
		return dataSource;
	}
	public static Connection getConn() throws SQLException {
		return dataSource.getConnection();
	}
	public static QueryRunner getQueryRunner( ) {
		return queryRunner;
	}
}
